#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<unistd.h>
#include<malloc.h>


int g_val = 100;
int ung_val;
int main(int argc, char*argv[],char*envp[])
{
    printf("code addr:%p\n",main);//代码段地址

    char* str = "hello world";
    printf("read only addr:%p\n",str);//常量区地址

    printf("init add:%p\n",&g_val);
    printf("uninit add:%p\n",&ung_val);

    int* p = malloc(10);
    printf("heap addr:%p\n",p);

    printf("stack addr:%p\n",&str);
    printf("stack addr:%p\n",&p);

    //命令行参数地址
    int i =0;
    for(i = 0; i < argc; i++)
    {
        printf("args addr:%p\n",argv[i]);
    }

    int j  = 0;
    while(envp[j])
    {
        printf("env addr:%p\n",envp[j]);
        j++;
    }
    return 0;
}
